package com.reremouse.rerebbs.web.mb.mag;

import com.reremouse.model.SystemConfig;
import com.reremouse.rerebbs.dao.ISystemConfigDAO;
import com.reremouse.rerebbs.web.mb.ApplicationBean;
import com.reremouse.util.SpringHelper;

import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

@ManagedBean
@ViewScoped
public class SystemConfigMB
        implements Serializable {
    SystemConfig sc;
    ISystemConfigDAO ts = (ISystemConfigDAO) SpringHelper.getSpringBean("SystemConfigDAO");
    @ManagedProperty("#{applicationBean}")
    ApplicationBean ab;

    public ApplicationBean getAb() {
        return this.ab;
    }

    public void setAb(ApplicationBean ab) {
        this.ab = ab;
    }

    public SystemConfig getSc() {
        return this.sc;
    }

    public void setSc(SystemConfig sc) {
        this.sc = sc;
    }

    @PostConstruct
    public void init() {
        this.sc = this.ts.getSystemConfig();
    }

    public void updateTimesNum() {
        this.ts.updateSystemConfig(this.sc);
        this.ab.setSystemConfig(this.sc);
        FacesMessage fm = new FacesMessage();
        fm.setSeverity(FacesMessage.SEVERITY_INFO);
        fm.setSummary("update success");
        FacesContext.getCurrentInstance().addMessage("", fm);
    }
}



/* Location:           F:\jsp源码\蝙蝠论坛系统\rerebbs\WEB-INF\classes\

 * Qualified Name:     com.reremouse.rerebbs.web.mb.mag.SystemConfigMB

 * JD-Core Version:    0.7.0.1

 */